﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace ContosoUniversity.Models
{
    public class Instructor
    {


        //You could put a [Required] attribute on the Instructor navigation property to specify that 
        //there must be a related instructor, but you don't have to do that because the InstructorID 
        //foreign key (which is also the key to this table) is non-nullable.
        //[Key]
        //[ForeignKey("Instructor")]
        public int ID { get; set; }

        [Required]
        [Display(Name = "Last Name")]
        [StringLength(50)]
        public string LastName { get; set; }

        [Column("FirstName"), Display(Name = "First Name"), StringLength(50, MinimumLength = 1)]
        public string FirstMidName { get; set; }

        [DataType(DataType.Date), Display(Name = "Hire Date")]
        public DateTime HireDate { get; set; }

        [Display(Name = "Full Name")]
        public string FullName
        {
            get { return LastName + ", " + FirstMidName; }
        }

        //The Courses and OfficeAssignment properties are navigation properties. As was explained earlier, 
        //they are typically defined as virtual so that they can take advantage of an Entity Framework feature called lazy loading. 
        public virtual ICollection<Course> Courses { get; set; }
        public virtual OfficeAssignment OfficeAssignment { get; set; }
    }
}